#ifndef CAMERA_H
#define CAMERA_H

extern struct IDirect3DDevice9* d3ddev;

#include <d3d9.h>
#include <d3dx9.h>
#include "mkListener.h"

#define _USE_MATH_DEFINES
#include <cmath>

// define the screen resolution
#define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 768

class camera
{
public:
	camera(mkListener *mk, D3DXVECTOR3 *position, float xAngle, float yAngle, float anglePace, float camPace);
	void update();
	void buildFrustum();
	bool pointInFrustum( D3DXVECTOR3* pPosition);
	bool outsideLeftPlane( D3DXVECTOR3* pPosition);
	bool outsideRightPlane( D3DXVECTOR3* pPosition);
	bool outsideTopPlane( D3DXVECTOR3* pPosition);
	bool outsideBottomPlane( D3DXVECTOR3* pPosition);
	bool outsideNearPlane( D3DXVECTOR3* pPosition);
	bool outsideFarPlane( D3DXVECTOR3* pPosition);

	float getPosX();
	float getPosY();
	float getPosZ();
protected:
	float xCamPosition;
	float yCamPosition;
	float zCamPosition;
	float xAngle;
	float yAngle;
	float anglePace;
	float camPace;
	mkListener *mk;

private:
	~camera();
	D3DXMATRIX matViewTrans,
			   matProjection;
	D3DXPLANE   m_frustum[6];
};

#endif
